Meta:Language select
without language selection.]] with language selection (English and French).]] Language select allows users to hide foreign languages on multilingual pages. This, for example, allows French readers to see only French text on multilingual pages (though they would still see Spanish on a Spanish-only page). At right are two screenshots of Template:Stub without and with a language selection of English and French using the CSS method (see below). Implementation There are two working implementations of language select. The preparation of a page for language selection is the same for both methods. The older CSS method allows multiple languages to be selected, most useful for multilingual users. However, it cannot recognize when no selected language is present, which results in no content being displayed. The newer JavaScript method detects the language of your browser automatically (you can configure it to ignore the browser setting), and does nothing if no selected language is present. However, it can only display one language at a time. Identifying multilingual pages Pages that implement language selection include a notice linking back to this page using . There has been no discussion on the logo to use for this purpose; Localisation2.svg is currently used. Image:Wiki-trans-icon.svg|Zscout370 proposal Image:Localisation2.svg|Pathoschild proposal Image:Globe of letters.png|"Globe of letters" proposal Image:Globe of letters.gif|Visible with any browser Delimiting languages Technical details A multilingual page is contained by the CSS class "multilingual", with text in every language contained within the class "lang-xx", where xx is a lowercase ISO 639 two-letter or three-letterlanguage code and the lang attribute. The lang attribute is contextually more correct, but the CSS required to hook into it is not supported by all browsers. If there is no two-letter code, the lowercase three-letter code is used. If you're translating existing messages and don't know what the language is, use the code "und". An example page in English, Arabic, Old English, French, Latin, and Occitan: This text is English. هذا النّص عربي. Þis wordu is Englisc. Ce texte est Français. Haec verba latina sunt. Aqueste tèxt es en Occitan. Template The template simplifies the implementation of language select. For example, the following two lines are equivalent: spanish: This text is spanish. Usage Note that the two implementations conflict with each other, so only one should be used at a time. The description below assumes you use the Monobook skin. Cascading StyleSheets Add the following lines to , editing as appropriate for the languages you wish to view. /* hide all languages */ .multilingual { display:none; } /* unhide selected languages */ .multilingual .lang-en, .multilingual .lang-fr { display:block; } If you are using a browser with good support for CSS (such as Mozilla Firefox or Opera) you should use this more contextually correct CSS. .multilingual *lang {display:none;} .multilingual *=en, .multilingual *=fr {display:block;} JavaScript The JavaScript method is activated by default on the Wikimedia MetaWiki. You can disable it by adding the following line to . ls_enable = false; You can see an example of the JavaScript in action below. If language selection is disabled, all of the text will be displayed. When specifying a language, use the code, not the full name. You can view the JavaScript code at action=render}} MediaWiki:Monobook.js. Changelog The code is maintained in a private Subversion repository. I still have been unable to contact an MediaWiki developers on getting this code into Wikimedia's Subversion repository. * Revision 1358 — Edward Z. Yang(Talk) 15:36, 19 February 2007 (UTC) ** If no cookie is present, code will sniff wgUserLanguage global variable ** If language is set to blank, delete the cookie and switch to auto-detection. * Revision 1133 — Edward Z. Yang(Talk) 22:33, 2 September 2006 (UTC) ** Tweaked Show all behavior to be more user-friendly: instead of overwriting your cookie, it only temporarily shows all the language strings. You can switch back by pressing Select ** Renamed Save to Select ** Styled the Select button to be bold. ** Factored out language strings See also * List of ISO 639 codes * External links * Language select over at Beta Wikiversity Categoría:CeraWiki:Traducción